//////////////////////////////////////////////////////////////////////////
//					Character Animation with Direct3D					//
//						   Author: C. Granberg							//
//							   2008 - 2009								//
//////////////////////////////////////////////////////////////////////////

#ifndef PHYSICS_NJIN
#define PHYSICS_NJIN

#include "Game Engine/Header/d3dUtil.h"
#include "Game Engine/Header/obb.h"
#include "Game Engine/Header/BulletUtil.h"
#include "Game Engine/Header/Object.h"
#include "Game Engine/Header/Mesh.h"
#include "Game Engine/Header/Player.h"

using namespace std;

class Physics
{
	public:
		Physics();
		~Physics();
		void Init( btDynamicsWorld* world, D3DXVECTOR3 pos, D3DXVECTOR3 size );
		void Release();
		void Update( float deltaTime );
		void Render( Mesh& mesh, D3DXMATRIX& lightViewProj, UINT count );
		void Reset();
		OBB* CreateOBB( D3DXVECTOR3 pos, D3DXVECTOR3 size );

		D3DXVECTOR3 RandomVector(D3DXVECTOR3 &min, D3DXVECTOR3 &max);
		float RandomFloat();

	private:
		ID3D10Effect* mFX;

		ID3D10Device* md3dDevice;
		vector<OBB*> m_boxes;

		btDynamicsWorld* mDynamicsWorld;

		btRigidBody *m_floor;

		float m_time;
};

#endif